import {
  login
} from '../../util/asyncWx.js'
import {
  request
} from '../../request/index.js'
import regeneratorRuntime from '../../lib/runtime/runtime';
// pages/auth/index.js
Page({

  async getUserInfo(e) {
    try {
      const {
        encryptedData,
        rawData,
        string,
        iv,
        signature
      } = e.detail
      const {
        code
      } = await login()
      const data = {
        encryptedData,
        rawData,
        string,
        iv,
        signature,
        code
      }
      //调用获取token的接口
      const res = await request({
        url: "/users/wxlogin",
        data,
        method: "post"
      })
      console.log(res)
      wx.setStorageSync("token", '没有企业账户没法完成支付功能呀...');
      wx.navigateBack({
        delta: 1
      });
    } catch (error) {

    }
  }
})